﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;

namespace AmiCheckin.UI.Converters
{
    public class List2StrConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {

            return string.Join(Environment.NewLine, ((ObservableCollection<string>)value).ToList());
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return new ObservableCollection<string>(value.ToString().Split(new[] { Environment.NewLine },StringSplitOptions.RemoveEmptyEntries).ToList());
        }
    }
}